<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<script type="text/javascript">
function deleteRow(tableID, obj) {//参数为表格ID，触发对象
//获得触发对象的行号，parentElement的个数取决于触发对象为TR的第几级子项，input=>td=>tr，所以parentElement有两个
var rowIndex = obj.parentElement.parentElement.rowIndex;
//var table = document.getElementById(tableID).deleteRow(rowIndex);
alert("您确定要删除吗？")
obj.parentElement.parentElement.parentElement.deleteRow(rowIndex); //再简化：省略tableID参数
}
</script>
<table border="1" id="tab1" width="90%">
<tbody>
<tr>
<th>序号</th>
<th>姓名</th>
<th>年龄</th>
<th>身份证</th>
<th>删除</th>
</tr>
<tr>
<td style="text-align: center;">1</td>
<td >测试一</td>
<td>15</td>
<td>1111111111111111111</td>
<td name="sc" style="text-align: center;"><input type="button" value="删除" onclick="deleteRow('tb',this)"/></td>
</tr>
<tr>
<td style="text-align: center;">2</td>
<td>测试二</td>
<td>20</td>
<td>2222222222222222222</td>
<td name="sc" style="text-align: center;"><input type="button" value="删除" onclick="deleteRow('tb',this)"/></td>
</tr>

<tr>
<td style="text-align: center;">3</td>
<td>测试三</td>
<td>20</td>
<td>3333333333333333333</td>
<td name="sc" style="text-align: center;"><input type="button" value="删除" onclick="deleteRow('tb',this)"/></td>
</tr>

<tr>
<td style="text-align: center;">4</td>
<td>测试四</td>
<td>20</td>
<td>4444444444444444444</td>
<td name="sc" style="text-align: center;"><input type="button" value="删除" onclick="deleteRow('tb',this)"/></td>
</tr>


</tbody>
</table>

</body>
</html>